<%@ page language="java" pageEncoding="UTF-8" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<%@ include file="../../common/common.jsp" %>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <title>${menu_name } - ${title }</title>
</head>
<link href="${ctx }/static/plugins/chosen_v1.6.2/chosen.css" rel="stylesheet"/>
<body
        <%@ include file="../../common/skin.jsp" %>
>
<%@ include file="../../common/head.jsp" %>
<%@ include file="../../common/menu.jsp" %>
<div class="J_content">
    <div class="mt20 plr20">
        <form action="${ctx }/channel/talent/pool/list" id="queryForm" method="post">
            <div class="J_toolsBar clearfix">
                <select name="talentType" class="t_text ml10" style="border-radius: 6px">
                    <option value="-1" selected>-人才类型-</option>
                    <c:forEach items="${map0}" var="p">
                        <option value="${p.key}" <c:if test="${dto.talentType == p.key}">selected</c:if>>
                                ${p.value}
                        </option>
                    </c:forEach>
                </select>
                <select name="type" class="t_text ml10" style="border-radius: 6px">
                    <option value="-1" selected>-学科类型-</option>
                    <c:forEach items="${map1}" var="p">
                        <option value="${p.key}" <c:if test="${dto.type == p.key}">selected</c:if>>
                                ${p.value}
                        </option>
                    </c:forEach>
                </select>
                <div class="t_button mgl30">
                    <a class="abtn red" href="javascript:myQuery();">
                        <i class="icon"></i>查询
                    </a>
                </div>
                <div class="t_button ml10">
                    <a class="abtn blue" href="javascript:myEdit();">
                        <i class="icon"></i>新增
                    </a>
                </div>
                <div class="t_label ml10">
                    记录数：<label style="color: red;" id="total">${page.totalCount }</label>
                </div>
            </div>

            <div class="J_table mt20">
                <div class="t_table">
                    <table>
                        <thead>
                        <tr>
                            <td>
                                <span>序号</span>
                            </td>
                            <td>
                                <span>人才类型</span>
                            </td>
                            <td>
                                <span>学科类型</span>
                            </td>
                            <td>
                                <span>头像</span>
                            </td>
                            <td>
                                <span>姓名</span>
                            </td>
                            <td>
                                <span>内容</span>
                            </td>
                            <td>
                                <span>状态</span>
                            </td>
                            <td>
                                <span>操作</span>
                            </td>
                        </tr>
                        </thead>
                        <tbody>
                        <c:choose>
                            <c:when test="${page.list != null && page.totalCount > 0 }">
                                <c:forEach items="${page.list }" var="u" varStatus="status">
                                    <tr>
                                        <td>
                                            <div class="t_text tc">
                                                    ${status.index+1 }
                                            </div>
                                        </td>
                                        <td>
                                            <div class="t_text tc">
                                                    ${u.columnInfo0.name }
                                            </div>
                                        </td>
                                        <td>
                                            <div class="t_text tc">
                                                    ${u.columnInfo1.name }
                                            </div>
                                        </td>
                                        <td>
                                            <div class="t_text tc">
                                                <c:choose>
                                                    <c:when test="${u.url != null && u.url != ''}">
                                                        <img src="${ctx }${u.url}" id="attachURL" width="100px"
                                                             height="100px"/>
                                                    </c:when>
                                                    <c:otherwise>
                                                        <img src="${ctx }/static/images/J_null.png" id="attachURL"
                                                             width="100px" height="100px"/>
                                                    </c:otherwise>
                                                </c:choose>
                                            </div>
                                        </td>

                                        <td>
                                            <div class="t_text tc">
                                                    ${u.name }
                                            </div>
                                        </td>
                                        <td>
                                            <div class="t_text tc">
                                                <c:if test="${fn:length(u.content)<=17}">
                                                    ${u.content}
                                                </c:if>
                                                <c:if test="${fn:length(u.content)>17}">
                                                    ${fn:substring(u.content,0,17)}...
                                                </c:if>
                                            </div>
                                        </td>
                                        <td>
                                            <div class="t_text tc">
                                                <c:choose>
                                                    <c:when test="${u.deleteFlag == 0}">
                                                        正常
                                                    </c:when>
                                                    <c:otherwise>
                                                        <label class="delete_flag">删除</label>
                                                    </c:otherwise>
                                                </c:choose>
                                            </div>
                                        </td>
                                        <td>
                                            <div class="t_link">
                                                <a href="javascript:stick('${u.id }');"><i class="icon"></i>置顶</a>
                                                <a href="javascript:myEdit('${u.id }');"><i class="icon"></i>编辑</a>
                                                <c:choose>
                                                    <c:when test="${u.deleteFlag == 0}">
                                                        <a href="javascript:updStatus('${u.id }');"><i
                                                                class="icon"></i>删除</a>
                                                    </c:when>
                                                    <c:otherwise>
                                                        <a href="javascript:updStatus('${u.id }');"><i
                                                                class="icon"></i>恢复</a>
                                                    </c:otherwise>
                                                </c:choose>
                                            </div>
                                        </td>
                                    </tr>

                                </c:forEach>
                            </c:when>
                            <c:otherwise>
                                <tr>
                                    <td colspan="8">
                                        <div class="J_null mt40">
                                            <img src="${ctx }/static/images/null.png">
                                            <p>暂无相关数据</p>
                                        </div>
                                    </td>
                                </tr>
                            </c:otherwise>
                        </c:choose>
                        </tbody>
                    </table>
                </div>
                <%@ include file="../../common/pager.jsp" %>
            </div>
        </form>
    </div>
</div>
<script src="${ctx }/static/plugins/chosen_v1.6.2/chosen.jquery.js"></script>
<script type="text/javascript">
    function myEdit(id) {
        window.location.href = '${ctx}/channel/talent/pool/edit?id=' + id;
    }

    function stick(id) {
        $.ajax({
            url: '${ctx}/channel/talent/stick/' + id,
            type: 'get',
            traditional: true,
            success: function (result) {
                if (result.success) {
                    window.location.reload();
                } else {
                    layer.alert('操作失败');
                }
            }
        });
    }

    function mySubmit() {
        $('#editForm').submit();
    }

    function myQuery() {
        $('#queryForm').submit();
    }

    function updStatus(id) {
        var content = '确定到执行操作吗?';
        layer.confirm(content, function (index) {
            layer.close(index);
            var loadIdx = layer.load();
            $.ajax({
                url: '${ctx}/channel/talent/pool/del',
                type: 'post',
                data: {
                    'id': id,
                },
                traditional: true,
                success: function (result) {
                    layer.close(loadIdx);
                    if (result.success) {
                        layer.alert('操作成功', function () {
                            window.location.reload();
                        });
                    } else {
                        layer.alert('操作失败');
                    }
                }
            });
        });
    }
</script>
</body>
</html>